// 积分管理相关类型定义

// 积分类型
export type PointsType = 'add' | 'deduct'

// 积分状态
export type PointsStatus = 'pending' | 'approved' | 'rejected' | 'cancelled'

// 积分记录
export interface PointsRecord {
  id: string
  departmentId: string
  departmentName: string
  responsiblePersonId: string
  responsiblePersonName: string
  eventDescription: string
  pointsType: PointsType
  pointsValue: number
  attachments: string[]
  recorderId: string
  recorderName: string
  recordTime: string
  status: PointsStatus
  approvalId?: string
  approvalTime?: string
  approvalComment?: string
  location?: string
  severity?: 'low' | 'medium' | 'high'
}

// 积分审批流程
export interface PointsApproval {
  id: string
  recordId: string
  record: PointsRecord
  approverId: string
  approverName: string
  approvalStatus: 'pending' | 'approved' | 'rejected'
  approvalTime?: string
  approvalComment?: string
  createTime: string
  updateTime: string
}

// 积分台账
export interface PointsLedger {
  id: string
  userId: string
  userName: string
  departmentId: string
  departmentName: string
  totalPoints: number
  addPoints: number
  deductPoints: number
  recordCount: number
  lastUpdateTime: string
}

// 部门积分汇总
export interface DepartmentPointsSummary {
  departmentId: string
  departmentName: string
  totalPoints: number
  addPoints: number
  deductPoints: number
  averagePoints: number
  employeeCount: number
  ranking: number
  lastUpdateTime: string
}

// 积分统计查询参数
export interface PointsQueryParams {
  page?: number
  pageSize?: number
  departmentId?: string
  userId?: string
  pointsType?: PointsType
  status?: PointsStatus
  startTime?: string
  endTime?: string
  keyword?: string
}

// 积分记录创建参数
export interface CreatePointsRecordParams {
  departmentId: string
  responsiblePersonId: string
  eventDescription: string
  pointsType: PointsType
  pointsValue: number
  attachments?: string[]
  location?: string
  severity?: 'low' | 'medium' | 'high'
}

// 积分审批参数
export interface ApprovePointsParams {
  approvalId: string
  approvalStatus: 'approved' | 'rejected'
  approvalComment?: string
}

// 批量导入参数
export interface BatchImportParams {
  file: File
  departmentId?: string
}

// 积分统计图表数据
export interface PointsChartData {
  labels: string[]
  datasets: {
    label: string
    data: number[]
    backgroundColor?: string
    borderColor?: string
  }[]
}

// 积分趋势数据
export interface PointsTrendData {
  date: string
  addPoints: number
  deductPoints: number
  netPoints: number
}

// 积分排行榜
export interface PointsRanking {
  rank: number
  userId: string
  userName: string
  departmentName: string
  totalPoints: number
  addPoints: number
  deductPoints: number
}